package com.cos.lession60.services.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cos.lession60.dao.EmpMapper;
import com.cos.lession60.entity.Emp;
import com.cos.lession60.services.EmpServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: COS
 * @time: 2022/3/15 14:29
 * @description:
 */
@Service
public class EmpServicesImpl extends ServiceImpl<EmpMapper, Emp> implements EmpServices {
    //复杂查询 mapper.xml
    @Autowired
    private EmpMapper empMapper;

    @Override
    public void doLogin(String ename, String pwd){
        Emp emp = empMapper.selectOne(new QueryWrapper<Emp>().eq("ename", ename));
        System.out.println(emp);

////        Emp emp = this.getBaseMapper().selectOne(new QueryWrapper<Emp>().eq("ename", ename));
//        Emp emp = this.getOne(new QueryWrapper<Emp>().eq("ename", ename));
//        if (emp != null) {
//            //做什么事情
//        }
    }

    @Override
    public List<Emp> getEmpWithDept() {
        return empMapper.getEmpWithDept();
    }

    @Override
    public List<Emp> getEmpWithDept2(Integer eno) {
        return empMapper.getEmpWithDept2(eno);
    }
}
